import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Router from "vue-router"

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/news',
    name: 'News',
    component: () => import('../views/News.vue'),
  },
  {
    path: '/NewsDetail1/:id',
    component: () => import('../views/NewsDetail1.vue'),
    props:true,
  },
  {
    path: '/NewsDetail2/:id',
    component: () => import('../views/NewsDetail2.vue'),
    props:true,
  },
  {
    path:'*',
    component:()=>import('@/views/NotFound.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
